home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / games / readcd32padfixed / cd32_2.s
Text File  |  1980-01-03  |  2KB  |  85 lines

  1.  
  2. waitvb:        cmp.b    #100,$dff006
  3.         bne.s    waitvb
  4.  
  5.         lea    CD32_Buttons1(pc),a0    ;a0.l = switches
  6.         bsr    Readpad1_CD32
  7.  
  8.         tst.b    CD32_REWIND1
  9.         beq.s    no_rwd
  10.         move.w    #$000,$dff180
  11.  
  12. no_rwd        tst.b    CD32_FORWARD1
  13.         beq.s    no_ffw
  14.         move.w    #$fff,$dff180
  15.  
  16. no_ffw        tst.b    CD32_PLAY1
  17.         beq.s    no_p
  18.         move.w    #$0ff,$dff180
  19.  
  20. no_p        tst.b    CD32_YELLOW1
  21.         beq.s    no_y
  22.         move.w    #$ff0,$dff180
  23.  
  24. no_y        tst.b    CD32_GREEN1
  25.         beq.s    no_g
  26.         move.w    #$0f0,$dff180
  27.  
  28. no_g        tst.b    CD32_RED1
  29.         beq.s    no_r
  30.         move.w    #$f00,$dff180
  31.  
  32. no_r        tst.b    CD32_BLUE1
  33.         beq.s    no_b
  34.         move.w    #$00f,$dff180
  35. no_b
  36.         btst    #6,$bfe001
  37.         bne.w    waitvb
  38.         rts
  39.  
  40. CD32_Buttons1:    ds.b    1        ;unused.. reserved
  41. CD32_BLUE1    ds.b    1        ;blue button  (ALSO same as :RMB)
  42. CD32_RED1    ds.b    1        ;red button   (ALSO same as :LMB)
  43. CD32_YELLOW1    ds.b    1        ;yellow button
  44. CD32_GREEN1    ds.b    1        ;green button
  45. CD32_FORWARD1    ds.b    1        ;fast forward button
  46. CD32_REWIND1    ds.b    1        ;rewind button
  47. CD32_PLAY1    ds.b    1        ;play button
  48.  
  49. ******************************************************************************
  50. * CD32 Controller (Port Input) Switch Reader
  51. * ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  52. ******************************************************************************
  53.  
  54. _custom        =    $dff000
  55. vhpos        =    6
  56. potgo        =    $34
  57. potinp        =    $16
  58. ciaaddra    =    $bfe201
  59. ciaapra        =    $bfe001
  60.  
  61.         cnop    0,4
  62. Readpad1_CD32:    lea    ciaapra,a5        ;a5 = $bfe001 ciaa base
  63.         lea    _custom,a6        ;a6 = $dff000 custom base
  64.         moveq    #0,d1            ;erase d1
  65.         move.l    d1,(a0)            ;clear em all
  66.         move.l    d1,4(a0)        ;all of them!
  67.         moveq    #7,d3            ;d3.w = constant
  68.         move.w    #$6f00,potgo(a6)    ;setup port
  69.         bset    d3,ciaaddra-ciaapra(a5)    ;start cia
  70. getswitch:    move.w    potinp(a6),d0        ;read current port input
  71.         bset    d3,(a5)            ;start cia
  72.         move.b    vhpos(a6),d2
  73. .catchraster    cmp.b    vhpos(a6),d2        ;wait 1 raster
  74.         beq.s    .catchraster
  75.         bclr    d3,(a5)            ;stop cia
  76.         addq.w    #1,d1            ;next switch
  77.         andi.w    #1<<14,d0        ;test bit 14
  78.         bne.s    not_on
  79.         st.b    (a0,d1.w)        ;set switch
  80. not_on:        cmp.w    d3,d1            ;is this switch ON????
  81.         ble.s    getswitch
  82.         bclr    d3,ciaaddra-ciaapra(a5)    ;clear cia
  83.         move.w    #-1,potgo(a6)        ;clear port
  84.         rts
  85.